﻿using Morus;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KAKA.Domain
{
    public partial class Message : IAggregateRoot
    {
        public static Message Create(string subject, string content, User forUser)
        {
            return new Message
            {
                CreateAt = DateTime.Now,
                Id = Guid.NewGuid(),
                Status = MessageStatus.None,
                Subject = subject,
                Content = content,
                User = forUser
            };
        }

        public void Notify(User forUser)
        {
            this.Notifications.Add(new Notification
            {
                Id = Guid.NewGuid(),
                Message = this,
                Read = false,
                Status = MessageStatus.None,
                User = forUser,
            });
        }
    }
}
